package ai.people.netmon.framework.domain.gang.construction.vo;

import ai.people.netmon.framework.domain.gang.construction.bo.RelationLibConfigBo;
import ai.people.netmon.framework.domain.gang.construction.entity.RelationRule;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 关系库-类型
 * </p>
 *
 * @author zhenglin
 * @since 2022-07-19
 */
@Data
@NoArgsConstructor
public class RelationLibConfigVO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @JSONField(serializeUsing = ToStringSerializer.class)
    private Long id;

    /**
     * 扩线关系点value
     */
    private String expListValue;
    /**
     * 扩线关系点name
     */
    private String expListName;
    /**
     * 类型value
     */
    private String expTypeValue;
    /**
     * 类型name
     */
    private String expTypeName;

    /**
     * 规则ID
     */
    @JSONField(serializeUsing = ToStringSerializer.class)
    private Long relationRuleId;

    /**
     * 规则名称
     */
    private String relationRuleName;

    /**
     * 配置的规则
     */
    private List<RelationRule.Rule> rule;

    /**
     * 是否禁用 1是 0否
     */
    private Integer lockFlag;


    public RelationLibConfigVO(RelationLibConfigBo record) {
        this.id = record.getId();
        this.expListValue = record.getExpListValue();
        this.expListName = record.getExpListName();
        this.expTypeValue = record.getExpTypeValue();
        this.expTypeName = record.getExpTypeName();
        this.relationRuleId = record.getRelationRuleId();
        this.relationRuleName = record.getRelationRuleName();
        this.rule = record.buildRule();
        this.lockFlag = record.getLockFlag();
    }
}
